﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Castle.ActiveRecord;
using NHibernate.Criterion;
using LIB;
using System.Collections;
using System.Web.UI.HtmlControls;

public partial class tuyen_dung : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int catID = 173;
            if (catID > 0)
            {
                hidCatID.Value = catID.ToString();
                hypLink.Text = Category_Info.Find(catID).catName;
                int pageIndex = ConvertUtility.ToInt32(Request.QueryString["page"]);
                if (pageIndex > 0)
                    bindNews(pageIndex);
                else
                    bindNews(1);
            }

        }
    }
    protected void bindNews(int pageIndex)
    {
        try
        {
            int catID = ConvertUtility.ToInt32(hidCatID.Value);
            Content_Info[] lstContent = Content_Info.getNewsInCatByLanguage(catID);
            repListContent.DataSource = lstContent.Skip((pageIndex - 1) * 30).Take(30);
            repListContent.DataBind();
            int totalPage = (int)Math.Ceiling(ConvertUtility.ToDouble(lstContent.Length) / 30);
            pagerbot.Text = ConvertUtility.buidPaging2(totalPage, pageIndex, HttpContext.Current.Request.Url.LocalPath + "?id=" + catID);

        }
        catch (Exception ex) { }
    }
}